/* 全局样式重置 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

body {
    display: flex;
    flex-direction: column;
    height: 100vh;
    background-color: #f5f7fa;
    color: #333;
    overflow: hidden;
}

/* 顶部导航区样式 */
.top-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.8rem 1.5rem;
    background-color: #ffffff;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
    z-index: 100;
}

.logo {
    display: flex;
    align-items: center;
    gap: 10px;
}

.logo i {
    font-size: 1.5rem;
    color: #4a6cf7;
}

.logo h1 {
    font-size: 1.2rem;
    font-weight: 600;
    color: #333;
}

.nav-controls {
    display: flex;
    gap: 12px;
    align-items: center;
}

.nav-btn {
    background-color: #f0f2f5;
    border: none;
    border-radius: 4px;
    padding: 8px 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.9rem;
    transition: background-color 0.2s;
}

.nav-btn:hover {
    background-color: #e4e6eb;
}

.status-indicator {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.8rem;
    color: #666;
}

.status-indicator i {
    color: #4caf50;
    font-size: 0.7rem;
}

/* 中部聊天区样式 */
.chat-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 1rem;
    background-color: #f5f7fa;
    overflow: hidden;
}

.chat-history {
    flex: 1;
    overflow-y: auto;
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    background-color: #ffffff;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.message {
    max-width: 80%;
    padding: 12px 16px;
    border-radius: 12px;
    animation: fade-in 0.3s ease-out;
}

@keyframes fade-in {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.user-message {
    align-self: flex-end;
    background-color: #e3f2fd;
    color: #0d47a1;
}

.bot-message {
    align-self: flex-start;
    background-color: #f1f1f1;
    color: #333;
}

.system-message {
    align-self: center;
    background-color: #fff3e0;
    color: #bf360c;
    font-style: italic;
    max-width: 90%;
}

.message-content {
    word-break: break-word;
}

.message-sql {
    margin-top: 8px;
    padding: 8px;
    background-color: #f8f9fa;
    border-radius: 4px;
    font-family: 'Courier New', Courier, monospace;
    font-size: 0.9rem;
    overflow-x: auto;
    color: #0d47a1;
}

.message-results {
    margin-top: 12px;
    overflow-x: auto;
}

.results-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

.results-table th, .results-table td {
    border: 1px solid #ddd;
    padding: 6px 10px;
    text-align: left;
}

.results-table th {
    background-color: #f2f2f2;
    font-weight: 600;
}

.results-table tr:nth-child(even) {
    background-color: #f9f9f9;
}

.chat-input-container {
    display: flex;
    gap: 8px;
    margin-top: 1rem;
    margin-bottom: 1rem;
    padding-right: 8px;
    background-color: #fff;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    overflow: hidden;
    align-items: center;
    min-height: 60px;
}

.chat-input {
    flex: 1;
    padding: 12px 16px;
    border: none;
    resize: none;
    height: 60px;
    font-size: 1rem;
    outline: none;
    line-height: 36px;
    align-items: center;
    display: flex;
}

.send-btn, .settings-btn {
    width: 48px;
    height: 48px;
    border: none;
    color: white;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    margin-top: 0;
}

.send-btn {
    background-color: #4a6cf7;
}

.settings-btn {
    background-color: #5c6bc0;
}

.send-btn:hover, .settings-btn:hover {
    transform: translateY(-1px);
    filter: brightness(1.1);
}

.send-btn:active, .settings-btn:active {
    transform: translateY(1px);
}

.send-btn i, .settings-btn i {
    font-size: 1.4rem;
}

/* 设置弹窗样式 */
.settings-modal {
    display: none;
    position: fixed;
    bottom: 80px;
    right: 20px;
    background-color: #fff;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    width: 280px;
    z-index: 1000;
    animation: slide-up 0.3s ease-out;
}

@keyframes slide-up {
    from { transform: translateY(20px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

.settings-content {
    padding: 1.2rem;
}

.settings-content h3 {
    margin-bottom: 1.2rem;
    color: #333;
    font-weight: 600;
    font-size: 1.1rem;
}

.option-items {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.option-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px;
    border-radius: 8px;
    background-color: #f8f9fa;
    transition: background-color 0.2s;
}

.option-item:hover {
    background-color: #f0f2f5;
}

.option-text {
    flex: 1;
    margin-right: 12px;
}

.option-label {
    display: block;
    font-weight: 500;
    color: #333;
    margin-bottom: 4px;
    font-size: 0.95rem;
}

.option-description {
    display: block;
    font-size: 0.75rem;
    color: #666;
}

.apply-options-btn {
    width: 100%;
    margin-top: 1rem;
    padding: 10px;
    background-color: #4a6cf7;
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.2s ease;
    font-size: 0.95rem;
}

.apply-options-btn:hover {
    background-color: #3a5cd8;
    transform: translateY(-1px);
}

.apply-options-btn:active {
    transform: translateY(1px);
}

/* 开关按钮样式 */
.switch {
    position: relative;
    display: inline-block;
    width: 46px;
    height: 24px;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #e0e0e0;
    transition: .3s;
    border-radius: 24px;
}

.slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: .3s;
    border-radius: 50%;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

input:checked + .slider {
    background-color: #4a6cf7;
}

input:checked + .slider:before {
    transform: translateX(22px);
}

/* 模态框样式 */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    justify-content: center;
    align-items: center;
}

.modal-content {
    background-color: #fff;
    padding: 1.5rem;
    border-radius: 8px;
    width: 90%;
    max-width: 600px;
    max-height: 80vh;
    overflow-y: auto;
    position: relative;
}

.close-btn {
    position: absolute;
    top: 10px;
    right: 15px;
    font-size: 1.5rem;
    cursor: pointer;
    color: #888;
}

.schema-editor, .import-form {
    margin-top: 1rem;
}

#schemaInput {
    width: 100%;
    height: 250px;
    padding: 0.8rem;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-family: 'Courier New', Courier, monospace;
    resize: vertical;
    margin-bottom: 1rem;
}

.file-upload {
    margin-bottom: 1.5rem;
}

.file-upload label {
    display: inline-block;
    padding: 8px 20px;
    background-color: #f0f2f5;
    border-radius: 4px;
    cursor: pointer;
    margin-bottom: 0.8rem;
}

.file-upload input[type="file"] {
    display: none;
}

#selectedFileName {
    font-size: 0.9rem;
    color: #666;
}

.modal-btn {
    padding: 8px 16px;
    background-color: #4a6cf7;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .top-nav {
        flex-direction: column;
        gap: 10px;
        padding: 1rem;
    }
    
    .nav-controls {
        width: 100%;
        justify-content: space-between;
    }
    
    .option-items {
        flex-direction: column;
        gap: 1rem;
    }
    
    .message {
        max-width: 90%;
    }
}

/* 数据源指示器样式 */
.data-source-indicator {
    display: flex;
    align-items: center;
    gap: 6px;
    background-color: #f0f2f5;
    padding: 6px 10px;
    border-radius: 4px;
    font-size: 0.9rem;
}

.data-source-indicator span:first-child {
    color: #666;
}

.data-source-indicator span:last-child {
    font-weight: 500;
    color: #4a6cf7;
}

/* 修改按钮样式 */
.primary-btn {
    background-color: #4a6cf7;
    color: white;
}

.primary-btn:hover {
    background-color: #3a5cd8;
}

.settings-section {
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 1px solid #eee;
}

.settings-section h4 {
    margin-bottom: 10px;
    color: #333;
    font-size: 0.9rem;
}

.model-selector {
    width: 100%;
    margin-bottom: 15px;
}

.model-select {
    width: 100%;
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 0.9rem;
    background-color: white;
    cursor: pointer;
}

.model-select:hover {
    border-color: #4a6cf7;
}

.model-select:focus {
    outline: none;
    border-color: #4a6cf7;
    box-shadow: 0 0 0 2px rgba(74, 108, 247, 0.1);
}

